﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.Surrogate.GroupMoneyModel>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	团队余额
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<fieldset>
    <legend>团队余额</legend>
    <div>
        <%Html.BeginForm("GroupMoney","Surrogate"); %>
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <%=Html.HiddenFor(p=>p.CurrenUid) %>
                <td>用户名:<%=Html.TextBoxFor(p=>p.UserName) %></td>
                <td>起始时间:<input name="StartTime"  onfocus = "WdatePicker()" value="<%="{0:yyyy-MM-dd}".Format(Model.StartTime) %>"/></td>
                <td>终止时间:<input name="EndTime"  onfocus = "WdatePicker()" value="<%="{0:yyyy-MM-dd}".Format(Model.EndTime) %>"/></td>
                <td><input type="submit" value="查找" /></td>
            </tr>
        </table>
        <%Html.EndForm(); %>
    </div>
<div>
    <table class="table" width="100%">
        <tr>
            <td colspan='9' align="left"><% 
                    var user = Model.CurrentUserCommands.Where(p =>p.Key.Propertie1==Model.LoginUid).Select(p=>new {uid=p.Key.Propertie1,commandID=p.Key.Propertie2,name=p.Value}).FirstOrDefault();
                    while (user!=null&&user.uid!=Model.CurrenUid)
                    {
                        %>
                            <%=Html.ActionLink(user.name, "GroupMoney", Url.Route(new { CurrenUid = user.uid ,Model.StartTime,Model.EndTime}),Url.Route(new {@class="a_blue" }))%>&nbsp;→&nbsp;
                        <%
                        user=Model.CurrentUserCommands.Where(p=>p.Key.Propertie2==user.uid).Select(p=>new {uid=p.Key.Propertie1,commandID=p.Key.Propertie2,name=p.Value}).FirstOrDefault();
                    }
                %><%=user==null?"":user.name+"&nbsp;→&nbsp;"%>
            </td>
        </tr>
        <tr class="th">
            <th>用户名</th>
            <th>类型</th>
            <th>可用余额</th>
            <th>冻结金额</th>
            <th>总充值金额</th>
            <th>总购彩金额</th>
            <th>总购彩返点</th>
            <th>总下级返点</th>
            <th>总中奖金额</th>
            <th>总提款金额</th>
            <%--<th>总下级返奖金额</th>--%>
        </tr>
        <% foreach (var item in Model.ChildAccountDetail)
           {var type=(UserType)item.Value.UserType;
               %>
                <tr>
                    <td><%=type == UserType.Member ? Html.Label(item.Value.LoginName) : Html.ActionLink(item.Value.LoginName, "GroupMoney", Url.Route(new { CurrenUid = item.Key,Model.StartTime,Model.EndTime }),Url.Route( new { @class = "a_blue" }))%></td>
                    <td><%=type.GetName() %></td>
                    <td><%=item.Value.Balance %></td>
                    <td><%=item.Value.Freez %></td>
                    <td><%=item.Value.AddMoney %></td>
                    <td><%=item.Value.Buy %></td>
                    <td><%=item.Value.BackMoney %></td>
                    <td><%=item.Value.BackMoney_Child %></td>
                    <td><%=item.Value.WinMoney %></td>
                    <td><%=item.Value.TackMoney %></td>
                    <%--<td><%=item.Value.WinMoney_Child %></td>--%>
                </tr>
               <%
           }
            %>
            <%if (Model.ChildsAccountSum != null)
              { %>
                <tr>
                    <td><%=user == null ? "" : user.name%> 直属下级合计</td>
                    <td></td>
                    <td><%=Model.ChildsAccountSum.Balance%></td>
                    <td><%=Model.ChildsAccountSum.Freez%></td>
                    <td><%=Model.ChildsAccountSum.AddMoney%></td>
                    <td><%=Model.ChildsAccountSum.Buy%></td>
                    <td><%=Model.ChildsAccountSum.BackMoney%></td>
                    <td><%=Model.ChildsAccountSum.BackMoney_Child%></td>
                    <td><%=Model.ChildsAccountSum.WinMoney%></td>
                    <td><%=Model.ChildsAccountSum.TackMoney%></td>
                    <%--<td><%=Model.ChildsAccountSum.WinMoney_Child%></td>--%>
                </tr>     
                <%} if (Model.AllChildsAccountSum != null)
              { %>
                <tr>
                    <td><%=user == null ? "" : user.name%> 所有下级合计</td>
                    <td></td>
                    <td><%=Model.AllChildsAccountSum.Balance%></td>
                    <td><%=Model.AllChildsAccountSum.Freez%></td>
                    <td><%=Model.AllChildsAccountSum.AddMoney%></td>
                    <td><%=Model.AllChildsAccountSum.Buy%></td>
                    <td><%=Model.AllChildsAccountSum.BackMoney%></td>
                    <td><%=Model.AllChildsAccountSum.BackMoney_Child%></td>
                    <td><%=Model.AllChildsAccountSum.WinMoney%></td>
                    <td><%=Model.AllChildsAccountSum.TackMoney%></td>
                    <%--<td><%=Model.AllChildsAccountSum.WinMoney_Child%></td>--%>
                </tr>     
                <%} %>
            <%
                   var page = Model.PageInfo;
                   if(page!=null){
                    %>
                    <tr>
                        <td colspan='9' align="center">
                            <%=Html.Pager(page.CurrPage, page.PageCount, page.SunCount, "PageInfo.CurrPage", Url.Route(new {  Model.CurrenUid,Model.StartTime,Model.EndTime }),"PageInfo.PageCount")%>
                        </td>
                    </tr>
                    <%} %>
    </table>
</div>
</fieldset>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
</asp:Content>
